<template>
  <el-button
    @click="del"
    type="danger"
    :disabled="is_null_obj(stuctureStore.stucture2)"
    >删除</el-button
  >

  <r-dialog v-model="show" width="400" :draggable="true">
    <template #header> 删除 组织结构 </template>

    <template #default>
      <div class="w-full flex justify-center items-center *:m-2">
        <el-icon size="40">
          <QuestionFilled />
        </el-icon>
        <div class="text-xl">确定要删除选中的1条记录吗？</div>
      </div>
    </template>

    <template #footer>
      <div class="w-50% m-auto flex justify-between">
        <el-button @click="enter" :icon="Select">确定</el-button>
        <el-button type="danger" @click="close" :icon="CloseBold"
          >取消</el-button
        >
      </div>
    </template>
  </r-dialog>
</template>

<script lang="ts" setup>
import { useStuctureStore } from "./store.ts";
import { ElButton, ElIcon } from "element-plus";
import { Select, CloseBold, QuestionFilled } from "@element-plus/icons-vue";
import { is_null_obj } from "@/func.ts";

const stuctureStore = useStuctureStore();
const show = ref(false);

const enter = () => {
  stuctureStore.del_stucture();
  show.value = false;
};
const close = () => {
  show.value = false;
};
const del = () => {
  show.value = true;
};
</script>
